package com.xinzhidi.web.bigscreen.controller;


import com.xinzhidi.common.core.controller.BaseController;
import com.xinzhidi.common.core.domain.AjaxResult;
import com.xinzhidi.web.bigscreen.domain.bo.BigScreenBo;
import com.xinzhidi.web.bigscreen.domain.po.LineChartPo;
import com.xinzhidi.web.bigscreen.service.IBigScreenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 首页大屏控制器
 *
 * @author ruoyi
 * @date 2023-05-29
 */
@RestController
@Api(tags = "大屏")
@RequestMapping("/bigScreen")
@RequiredArgsConstructor
public class BigScreenController extends BaseController {

    private final IBigScreenService bigScreenService;

    @ApiOperation("设备统计")
    @PostMapping("/deviceStatistics")
    public AjaxResult deviceStatistics(@Validated @RequestBody BigScreenBo bigScreenBo){
        return AjaxResult.success(bigScreenService.deviceStatistics(bigScreenBo));
    }



    @ApiOperation("数据总览")
    @PostMapping("/dataOverview")
    public AjaxResult dataOverview(@Validated @RequestBody BigScreenBo bigScreenBo){
        return AjaxResult.success(bigScreenService.dataOverview(bigScreenBo));
    }

    @ApiOperation("节能数据对比")
    @PostMapping("/energyData")
    public AjaxResult energyData(@Validated @RequestBody BigScreenBo bigScreenBo){
        return AjaxResult.success(bigScreenService.energyData(bigScreenBo));
    }


    @ApiOperation("预警信息")
    @PostMapping("/warningInformation")
    public AjaxResult warningInformation(@Validated @RequestBody BigScreenBo bigScreenBo){
        return AjaxResult.success(bigScreenService.warningInformation(bigScreenBo));
    }

    @ApiOperation("折线图")
    @PostMapping("/lineChart")
    public AjaxResult lineChart(@Validated @RequestBody LineChartPo po){
        return AjaxResult.success(bigScreenService.lineChart(po));
    }


    @ApiOperation("指标统计")
    @ApiImplicitParam(name = "plotId", value = "小区id", required = true, dataType = "int", paramType = "path", dataTypeClass = Long.class)
    @GetMapping("/indexStatistics")
    public AjaxResult indexStatistics(Long plotId){
        return AjaxResult.success(bigScreenService.indexStatistics(plotId));
    }

    @ApiOperation("预警分类")
    @ApiImplicitParam(name = "plotId", value = "小区id", required = true, dataType = "int", paramType = "path", dataTypeClass = Long.class)
    @GetMapping("/warnType")
    public AjaxResult warnType(Long plotId){
        return AjaxResult.success(bigScreenService.warnType(plotId));
    }


    @ApiOperation("15天天气预告")
    @ApiImplicitParam(name = "cityCode", value = "城市code", required = true)
    @GetMapping("/getWeather")
    public AjaxResult getWeather(String cityCode){
        return AjaxResult.success(bigScreenService.getWeather(cityCode));
    }

    @ApiOperation("24小时实时天气")
    @ApiImplicitParam(name = "cityCode", value = "城市code", required = true)
    @GetMapping("/getRealTime")
    public AjaxResult getRealTime(String cityCode){
        return AjaxResult.success(bigScreenService.getRealTime(cityCode));
    }

    @ApiOperation("天气预警")
    @ApiImplicitParam(name = "cityCode", value = "城市code", required = true)
    @GetMapping("/weatherWarning")
    public AjaxResult weatherWarning(String cityCode){
        return AjaxResult.success(bigScreenService.weatherWarning(cityCode));
    }
}
